<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html">
<h:head>
    <title>#{msg.page_AutoBaraholka}</title>
    <h:outputStylesheet library="css" name="table-Advertisement-style.css"/>



</h:head>
<h:body>


    <ui:decorate template="/sample.xhtml">
        <ui:define name="body">

            <h:form>
                <div style="align-items: center">
                    <h:commandButton value="Create PDF"  action="#{car.exportPDF}" />
                </div>
                <h:dataTable value="#{car.cars}" var="itemCar"
                             styleClass="order-table"
                             headerClass="order-table-header"
                             rowClasses="order-table-odd-row,order-table-even-row"
                             columnClasses="second,first"

                        >

                    <h:column>
                        <f:facet name="header">
                            <h:commandLink action="#{car.sortById}">
                                id
                            </h:commandLink>
                        </f:facet>
                        #{itemCar.id}
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            #{msg.text_AddAdberDescription}
                        </f:facet>

                        <h:outputLink value="/car">
                            <h:outputFormat id="infoCar" value="
                         #{msg.text_AddAdverBrand}: #{itemCar.transport.brand.nameEn}, #{msg.text_AddAdverModel}:#{itemCar.model.nameEn},
                         #{msg.text_AddAdverColor}: #{itemCar.transport.color.nameRu}, #{msg.text_AddAdverCondition}: #{itemCar.transport.condition.nameRu},
                         #{msg.text_AddAdverBodyType}: #{itemCar.bodyType.nameRu}, #{msg.text_AddAdverTypeEngine}: #{itemCar.typeEngine.nameRu},
                         #{msg.text_AddAdverPrivod}: #{itemCar.privod.nameRu}, #{msg.text_AddAdverValue}: #{itemCar.valueEngine}; "/>

                            <f:param name="id" value="#{itemCar.id}" />
                        </h:outputLink>

                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:commandLink action="#{car.sortByDate}">
                                #{msg.text_AddAdverDate}
                            </h:commandLink>
                        </f:facet>
                        <h:outputText value="#{itemCar.transport.date}" style="text-align: center">
                            <f:convertDateTime pattern="yyyy" />
                        </h:outputText>
                    </h:column>
                    <h:column>
                        <f:facet name="header">
                            <h:commandLink action="#{car.sortByPrice}">
                                #{msg.text_AddAdverPrice}
                            </h:commandLink>
                        </f:facet>
                        <h:outputText value=" #{itemCar.transport.price}" style="text-align: center">
                            <f:convertNumber type="currency"
                                             currencySymbol="#{itemCar.transport.currency.shortnameEn}"
                                             groupingUsed="true"
                                             minFractionDigits="2"
                                             maxFractionDigits="2"/>
                        </h:outputText>
                        #{itemCar.transport.currency.shortnameEn}
                    </h:column>


                </h:dataTable>



            </h:form>
        </ui:define>
    </ui:decorate>










</h:body>
</html>


